//
//  YSGMyopiaRecordDetailModel.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2021/1/6.
//  Copyright © 2021 QDSG. All rights reserved.
//

import HandyJSON

protocol YSGMyopiaRecordCellDelegate: NSObjectProtocol {
    func eyePressureCell(deleteHandle cell: YSGMyopiaRecordEyePressureCell)
    func eyePressureCell(_ cell: YSGMyopiaRecordEyePressureCell, checkInfo: YSGMyopiaRecordDetailCheckInfo)
    func eyeVisionCell(_ cell: YSGMyopiaEyeVisionCell, checkInfo: YSGMyopiaRecordDetailCheckInfo)
    func eyeRefractiveCell(_ cell: YSGMyopiaEyeDegreeCell, checkInfo: YSGMyopiaRecordDetailCheckInfo)
}

extension YSGMyopiaRecordCellDelegate {
    func eyePressureCell(deleteHandle cell: YSGMyopiaRecordEyePressureCell) {}
    func eyePressureCell(_ cell: YSGMyopiaRecordEyePressureCell, checkInfo: YSGMyopiaRecordDetailCheckInfo) {}
    func eyeVisionCell(_ cell: YSGMyopiaEyeVisionCell, checkInfo: YSGMyopiaRecordDetailCheckInfo) {}
    func eyeRefractiveCell(_ cell: YSGMyopiaEyeDegreeCell, checkInfo: YSGMyopiaRecordDetailCheckInfo) {}
}

/// 检查记录类型
enum YSGMyopiaRecordType: Int, HandyJSONEnum {
    /// 眼底照
    case eyePhoto = 101
    /// 眼压
    case eyePressure
    /// 眼前节
    case eyePrevious
    /// 视力
    case eyeVision
    /// 屈光
    case eyeRefractive
    
    var imageType: UploadImageType {
        switch self {
        case .eyePressure: return .eyePressure
        case .eyeVision: return .eyeVision
        case .eyeRefractive: return .eyeRefractive
        default: return .chat
        }
    }
}

enum YSGMyopiaRecordStatus: Int, HandyJSONEnum {
    case waitIssue, issued, waitCheck, finished
}

struct YSGMyopiaRecordDetailModel: HandyJSON {
    /// 检查详情id
    var checkFormDetailId: String?
    /// 检查类型字符串
    var checkItem: String?
    /// 检查类型枚举
    var checkItemCode: YSGMyopiaRecordType?
    /// 检查单号
    var applyFormId: String?
    /// 患者姓名
    var patientName: String?
    /// 检查部位
    var checkSeries: String?
    /// 检查标志（0等待下发，1已下发到设备，2待检查，3已完成）
    var checkDetailFlag: YSGMyopiaRecordStatus?
    /// 检查预约时间
    var checkTime: String?
    /// 医院名称
    var hosName: String?
    /// 是否能取消预约 1-可取消 0-不可取消
    var cancelFlag: Int?
    
    /// 是否已编辑 2-已编辑 其它-未编辑
    var checkFlag: Int?
    
    /// 右眼图片
    var oD: String?
    var oDResourceId: Int = 0
    /// 左眼图片
    var oS: String?
    var oSResourceId: Int = 0
    /// 检查图片
    var url: String?
    var resourceId: Int = 0
    /// 检查详情信息
    var impression: [YSGMyopiaRecordDetailCheckInfo]?
}

struct YSGMyopiaRecordDetailCheckInfo: HandyJSON {
    var title: String?
    
    /// 右眼眼压
    var odEyePressure: String?
    /// 左眼眼压
    var osEyePressure: String?
    
    /// 视力
    var eyeVision: String?
    
    /// 球镜度数
    var ballDegree: String?
    /// 柱镜度数
    var columnDegree: String?
    /// 轴位
    var axis: String?
    
    var isCanDelete: Bool = false
}
